import request from "@/api/request.js"
import {usetokenstore} from "@/store/token.js";


export const AddOrderService=(AddItemOrderDTO)=>{
    const tokenstore = usetokenstore();
    const params = new URLSearchParams()
    for(let key in AddItemOrderDTO){
        params.append(key,AddItemOrderDTO[key])
    }

    return request.post("/order/addOrder",params,{headers:{'jwt':tokenstore.token}})
}

export const getOderDetailService=(pageNum,pageSize)=>{
    const tokenstore = usetokenstore();
    const token = tokenstore.token

    const params = new URLSearchParams()
    params.append("pageNum",pageNum)
    params.append("pageSize",pageSize)
    return request.post("/order/getOrderDetail",params,{headers:{'jwt':token}})
}

export const getOrderAndItemDetailService=(orderId)=>{
    const params = new URLSearchParams()
    params.append("orderId",orderId)


    return request.post("/order/getOrderAndItemDetail",params)
}